import localZhCN from './i18n/zh-cn.js'
import localEn from './i18n/en.js'
import 'virtual:svg-icons-register'
import {
	ResourceConn
} from './service/resource-conn.js'
import {
	ResouceCatalog
} from './service/resource-catalog.js'
import {
	ResouceTableType
} from './service/resource-table-type'
import {
	ResouceViewType
}
from './service/resource-view-type'
import {
	ResouceFunctionType
} from './service/resource-function-type'
import {
	ResouceTable
} from './service/resource-table'
import {
	ResouceView
} from './service/resource-view'
import {
	SqlBuilder
} from './service/SqlBuilder'

export default (opt) => {
	const i18n = opt.i18n
	console.log(opt)
	// 添加i18n 国际化信息
	i18n.add('zh-cn', localZhCN)
	i18n.add('en', localEn)
	return {
		// 左侧资源
		resource: {
			conn: {
				//连接图标
				icon: '#dbant-icon-mysql-conn',
				//元数据配置
				metadata: (params) => new ResourceConn(opt, params).getMetadata(),
				//连接右键返回数据
				contextMenu: function (params) {
					return new ResourceConn(opt, params).getContextMenus();
				}
			},
			catalog: {
				//元数据配置
				metadata: (params) => new ResouceCatalog(opt, params).getMetadata(),
				//连接图标
				//连接右键返回数据
				contextMenu: function (params) {
					return new ResouceCatalog(opt, params).getContextMenus();
				}
			},
			table_type: {
				//元数据配置
				metadata: (params) => new ResouceTableType(opt, params).getMetadata(),
				//连接图标
				//连接右键返回数据
				contextMenu: function (params) {
					return new ResouceTableType(opt, params).getContextMenus();
				}
			},
			view_type: {
				//元数据配置
				metadata: (params) => new ResouceViewType(opt, params).getMetadata(),
				//连接图标
				//连接右键返回数据
				contextMenu: function (params) {
					return new ResouceViewType(opt, params).getContextMenus();
				}
			},
			function_type: {
				//元数据配置
				metadata: (params) => new ResouceFunctionType(opt, params).getMetadata(),
				//连接图标
				//连接右键返回数据
				contextMenu: function (params) {
					return new ResouceFunctionType(opt, params).getContextMenus();
				}
			},
			table: {
                //数据展示配置
                dataView: (params) => new ResouceTable(opt, params).getDataViewConfig(), 
				//元数据配置
				metadata: (params) => new ResouceTable(opt, params).getMetadataConfig(),
				//连接图标
				//连接右键返回数据
				contextMenu: function (params) {
					return new ResouceTable(opt, params).getContextMenus();
				}
			},
			view: {
				//数据展示配置
				dataView: (params) => new ResouceView(opt, params).getDataViewConfig(),
				//元数据配置
				metadata: (params) => new ResouceView(opt, params).getMetadataConfig(),
				//连接图标
				//连接右键返回数据
				contextMenu: function (params) {
					return new ResouceView(opt, params).getContextMenus();
				}
			}

		},
		sqlBuilder: new SqlBuilder(),
		//路由信息
		router: [{
			name: "testHome",
			path: "/test/testHome",
			meta: {
				name: "指定的首页"
			},
			// component: MagicTaskInfo
		}]
	}
}
